{% load debate_tags i18n %}

<div class="card mt-md-3">
  <div class="list-group list-group-flush">

    <div class="list-group-item">
      <h4 class="card-title mb-0">
        {{ card_title|safe }}
      </h4>
    </div>

      <div class="list-group-item">
        {% if not use_code_names or private_url or admin_page %}
          {% if team.short_name == team.long_name %}
            <div>
              <strong>{% trans "Team name:" %}</strong>
              {{ team.long_name }}
            </div>
          {% else %}
            <div>
              <strong>{% trans "Full team name:" %}</strong>
              {{ team.long_name }}
            </div>
            <div>
              <strong>{% trans "Short team name:" %}</strong>
              {{ team.short_name }}
            </div>
          {% endif %}
        {% endif %}
        {% if pref.team_code_names != 'off' %}
          <div>
            <strong>{% trans "Code name:" %}</strong>
            {% if team.code_name %}
              {{ team.code_name }}
            {% else %}
              <span class="text-muted">{% trans "No code name assigned" %}</span>
            {% endif %}
          </div>
        {% endif %}
        {% if pref.show_emoji %}
          <div>
            <strong>{% trans "Emoji:" %}</strong>
            {% if team.emoji %}
              {{ team.emoji }}
            {% else %}
              <span class="text-muted">{% trans "No emoji assigned" %}</span>
            {% endif %}
          </div>
        {% endif %}
      </div>

    {% if pref.show_speakers_in_draw %}
      <div class="list-group-item">
        <strong>{% trans "Speakers:" %}</strong>
        {% for speaker in team.speakers %}
          {{ speaker.name }}{% if not forloop.last %}{% trans ", " %}{% endif %}
        {% empty %}
          {% trans "None" %}
        {% endfor %}
      </div>
    {% endif %}

    {% if pref.public_break_categories or admin_page or private_url %}
      <div class="list-group-item {% if not pref.public_break_categories %} list-group-item-secondary{% endif %}">
        <div>
          <strong>{% trans "Eligible for break categories:" %}</strong>
          {% for category in team.break_categories.all %}
            {{ category.name }}{% if not forloop.last %}{% trans ", " %}{% endif %}
          {% empty %}
            {% trans "None" %}
          {% endfor %}
        </div>
        {% if participant %}
          <div>
            <strong>{% trans "Speaker categories:" %}</strong>
            {% for category in participant.categories.all %}
              {{ category.name }}{% if not forloop.last %}{% trans ", " %}{% endif %}
            {% empty %}
              {% trans "None" %}
            {% endfor %}
          </div>
        {% endif %}
      </div>
    {% endif %}

    {% if pref.show_team_institutions or admin_page or private_url %}
      <div class="list-group-item {% if not pref.show_team_institutions %} list-group-item-secondary{% endif %}">
        <div>
          <strong>{% trans "Institution:" %}</strong>
          {% if team.institution %}
            {{ team.institution.name }}
          {% else %}
            <span class="text-muted">{% trans "Unaffiliated" %}</span>
          {% endif %}
        </div>
        {% if team.institution.region %}
          <div>
            <strong>{% trans "Region:" %}</strong>
            {{ team.institution.region.name }}
          </div>
        {% endif %}
      </div>
    {% endif %}

    {% if admin_page %}
      <div class="list-group-item list-group-item-secondary">

        <div>
          <strong>{% trans "Institutional Conflicts:" %}</strong>
          {% for ic in team.teaminstitutionconflict_set.all %}
            {{ ic.institution.name }}{% if not forloop.last %}{% trans "; " %}{% endif %}
          {% empty %}
            {% trans "None" %}
          {% endfor %}
        </div>

        <div>
          <strong>{% trans "Adjudicator Conflicts:" %}</strong>
          {% for ac in team.adjudicatorteamconflict_set.all %}
            {{ ac.adjudicator.name }}{% if not forloop.last %}{% trans ", " %}{% endif %}
          {% empty %}
            {% trans "None" %}
          {% endfor %}
        </div>

      </div>

      <div class="list-group-item list-group-item-secondary">
        <strong>{% trans "Room Constraints:" %}</strong>
        {% for vc in team.venue_constraints.all %}
          {{ vc.category }}{% if not forloop.last %}{% trans ", " %}{% endif %}
        {% empty %}
          {% trans "None" %}
        {% endfor %}
      </div>

    {% endif %}

  </div>
</div>
